package com.winhxd.b2c.order.api;

import com.winhxd.b2c.common.constant.BusinessCode;
import com.winhxd.b2c.common.context.CustomerUser;
import com.winhxd.b2c.common.context.UserContext;
import com.winhxd.b2c.common.domain.ResponseResult;
import com.winhxd.b2c.common.domain.order.condition.OrderPayInfoCondition;
import com.winhxd.b2c.common.domain.order.vo.OrderPayVO;
import com.winhxd.b2c.common.exception.BusinessException;
import com.winhxd.b2c.order.service.OrderPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: hxd-outlet-parent
 * @description: 订单支付
 * @author: liuhanning
 * @create: 2019-01-08 11:29
 **/
@RestController
@Api(tags = "ApiOrderPay")
@RequestMapping(value = "/api-order/order")
public class ApiOrderPayController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ApiOrderPayController.class);

    @Autowired
    private OrderPayService orderPayService;

    @ApiOperation(value = "订单支付凭证", notes = "订单支付凭证")
    @RequestMapping(value = "/4015/v1/getOrderPayInfo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseResult<OrderPayVO> getOrderPayInfo(@RequestBody OrderPayInfoCondition condition) {
        String logTitle = "/api-order/order/4015/v1/getOrderPayInfo-C端获取支付信息";
        LOGGER.info("{}=--开始--{}", logTitle, condition);
        ResponseResult<OrderPayVO> result = new ResponseResult<>();
        //获取当前登录门店Id
        CustomerUser customerUser = UserContext.getCurrentCustomerUser();
        result.setData(orderPayService.getOrderPayInfo(condition,customerUser));
        LOGGER.info("{}=--结束 result={}", logTitle, result);
        return result;
    }


}
